package com.iweb.tmall.service;

import com.iweb.tmall.entity.Specification;
import com.iweb.tmall.global.ErrorEnum;
import com.iweb.tmall.global.ResponseData;
import com.iweb.tmall.mapper.SpecificationMapper;
import com.iweb.tmall.param.SpecificationParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class SpecificationServiceImpl implements SpecificationService {
    @Autowired
    private SpecificationMapper specificationMapper;
    @Override
    public ResponseData getList(SpecificationParam param) {
        return null;
    }

    @Override
    public ResponseData deleteById(Integer id) {
        return null;
    }

    @Override
    public ResponseData updateById(Specification entity) {
        return null;
    }

    @Override
    public ResponseData save(Specification entity) {
        ResponseData responseData = null;
        int row = specificationMapper.insert(entity);
        if (row > 0){
            responseData = new ResponseData(entity);
        }else {
            responseData = new ResponseData(ErrorEnum.DATABASE_SERVICE_ERROR);
        }
        return responseData;
    }

    @Override
    public ResponseData getById(Integer id) {
        return null;
    }
}
